<!DOCTYPE html>
<script src="../../../resources/js-test.js"></script>
<div id="host"></div>
<script>
    var root = host.attachShadow({mode: 'open'});
    root.innerHTML = '<style title="not-preferred">div { color: red }</style><style title="ignored">div { color: green }</style><div>Should be green</div>';
</script>
<style>#alternate { color: green }</style>
<link rel="alternate stylesheet" title="not-preferred" href="data:text/css,%23alternate { color: red }">
</style>
<div id="alternate">Should be green</div>
<script>
    description("Title attribute should be ignored for style elements in shadow trees.");

    shouldBeEqualToString("getComputedStyle(root.querySelector('div')).color", "rgb(0, 128, 0)");
    shouldBeEqualToString("getComputedStyle(alternate).color", "rgb(0, 128, 0)");
    shouldBeNull("host.shadowRoot.styleSheets[0].title");
</script>
